package com.example.myapplication3;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

public class RegeistActivity extends AppCompatActivity {
    private EditText mEditName;
    private EditText mEditPassword;
    private Button mBtnRegister;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_regist);
        mEditName = findViewById(R.id.name);
        mEditPassword = findViewById(R.id.password);
        mBtnRegister = findViewById(R.id.regist);
        mBtnRegister.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(RegeistActivity.this, MainActivity.class);
                startActivity(intent);
            }
        });
    }

    @Override
    public void finish() {
        Intent intent = new Intent();
        intent.putExtra("name", mEditName.getText().toString());
        intent.putExtra("password", mEditPassword.getText().toString());
        setResult(RESULT_OK, intent);
        super.finish();
    }
}
